# $Id: PKGBUILD 54061 2011-08-13 02:36:39Z ebelanger $
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
# Contributor: Jeff Mickey <jeff@archlinux.org>
# Contributor: Thayer Williams <thayer@archlinux.org>
# Maintainer: schuay <jakob.gruber@gmail.com

pkgname=dopewars
pkgver=1.5.12
pkgrel=6
pkgdesc="A drug dealing game set in New York"
url="http://dopewars.sourceforge.net/"
license=('GPL')
arch=('i686' 'x86_64')
depends=('gtk2' 'alsa-lib' 'audiofile' 'sdl_mixer' 'ncurses')
install='dopewars.install'
source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz")
md5sums=('debf749de9053dc2fb2e74c37ae06206')

build() {
    cd "$srcdir/$pkgname-$pkgver"

    ./configure --prefix=/usr --localstatedir=/var/games \
        --mandir=/usr/share/man
    make
}

package() {
    cd "$srcdir/$pkgname-$pkgver"

    make DESTDIR="$pkgdir" install

    # setup shortcut menu entries
    mkdir -p "$pkgdir/usr/share/applications"
    mv "$pkgdir/usr/share/gnome/apps/Games/dopewars.desktop" \
       "$pkgdir/usr/share/applications"
    rm -r "$pkgdir/usr/share/gnome"

    # set appropriate permissions and destinations
    chown root:games "$pkgdir/usr/bin/dopewars"
    chmod 2755 "$pkgdir/usr/bin/dopewars"
    chown root:games "$pkgdir/var/games"
    chmod 775 "$pkgdir/var/games"

    # Handle the scores file creation in the install script
    rm "$pkgdir/var/games/dopewars.sco"
}

